Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

callbacks for success/failure on stream sending #182

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Jul 11, 2012

Currently, when sending any kind of stanza, you submit it to the queue and then never know what happened. It would be nice to be able to get callbacks when the stanza is actually sent over the tcp socket (or if it errors out on send). This patch also gives the ability to send extra data along to the callback so that additional state can be passed along.

Obviously, this doesn't guarantee that the message actually made it to the recipient, but it does let us know if it made it to the wire or not (as far as our program is concerned).

@legastero
Copy link
Collaborator

Interesting. This sounds like something that would be suited for the XEP-0198 plugin, since that lets you know the stanza made it to at least the server.

@ghost
Copy link
Author

ghost commented Jul 11, 2012

XEP-0198 support would be awesome, I admit. The primary xmpp servers I deal with, though, are gtalk and facebook, neither of which seem to implement that (correct me if I've missed something). I have dialed back my expectations to only contending with the underlying network and its issues. The current socket_error event does not give enough information to determine what exactly failed. Hence if there is a network problem and a message doesn't get sent, there's currently no good way to know what didn't get sent. Therefore, the failure event. I added the success event for symmetry since I'm tracking successful and failed messages in detail.

BTW, I don't necessarily expect you guys to accept this submission. I just wanted to offer it to the project in case it solves problems other people have encountered. My situation may be somewhat unique.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants